﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AutoPartsSearch.Domain.Abstract;
using System.Globalization;

namespace AutoPartsSearch.Web.Controllers
{
    public class LanguageController : Controller
    {
        private ILanguageGetter _languageGetter;

        public LanguageController(ILanguageGetter languageGetter)
        {
            this._languageGetter = languageGetter;
        }

        public ActionResult ChangeLanguage(string lang, string returnUrl)
        {
            var ci = new CultureInfo(lang);
            this._languageGetter.SetLanguage(ci);
            return Redirect(returnUrl);
        }


    }
}
